package common;

/**
 * created by sonite on 2018/8/3
 */
public class DdosTest {

    public static void main(String args[]){
       /* String body="<189>Jul 31 2018 16:02:02 GT-JH-EH-DDOS-8160-2 %%01DDOS/5/WHITELIST(l)[2227368]:ZoneID=\"88\" ZoneName=\"localip\" DevIP=192.168.1.197, Slot=2, CPU=3, " +
                "Whitelist=\"139.159.208.106 220.181.132.199 139.159.208.108 222.169.178.239 222.168.201.157 180.141.79.20 116.1.165.2 117.136.75.92 106.39.191.112 116.85.26.225 144.0.12.166 113.66.95.230 202.134.9.135 122.247.145.38 114.225.85.220 49.7.4.40 49.92.159.192 119.188.250.21 122.114.245.143 114.135.208.15 27.159.249.87 106.119.44.107 14.116.141.213 14.116.141.5\"," +
                " BeginTime=\"2018-8-1 0:1:32\", EndTime=\"2018-8-1 0:2:2\", " +
                "Reason=\"Ack check defend auto-added\", " +
                "Lifetime=\"1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800 1800.";
*/

        String body="<189>1533540695 tcp://192.168.1.86:10000 %%01CCAGENT/5/STAT(1):type=6 obj=1694 obj_name=183.131.207.78_443_tcp ip=183.131.207.78 port=443 proto=6 src_ip=36.41.178.113 c2s_p=3 c2s_B=2530 s2c_p=2 s2c_B=256 c_syn=0 c_ack=3 c_fin=0 c_rst=0 s_syn=0 s_ack=2 s_fin=0 s_rst=0 cps=0 session=1";
       String splitStr= StringTransTools.parseString(body,"%%",",");

       String tranOne=body.substring(body.indexOf("%%")+2);
       String tranTwo="";
       if(tranOne.indexOf("(")>0){
           tranTwo=tranOne.substring(0,tranOne.indexOf("("));
       }else{
           tranTwo=tranOne.substring(0,tranOne.indexOf(":"));
       }
        String s[]=tranTwo.split("/");
        if(s!=null&&s.length==3){
            System.out.println("s2=="+s[2]);
        }
      String   logType="\t8 Aug 7 2018 03";
        if(logType.indexOf(">")>0){
            logType="other";
        }
        System.out.println("splitStr = " + logType);

    }
}
